﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Xml.Serialization;

namespace _1041326_1041339_1041433.UserPages
{
    public partial class BuySale : System.Web.UI.Page
    {
          String url = "http://localhost:1871/Service.svc";
        protected void Page_Load(object sender, EventArgs e)
        {
            HienThiTinMuaBan();
        }
        private void HienThiTinMuaBan()
        {
            WebRequest wr = WebRequest.Create(url + "/news/getAll");
            WebResponse wp = wr.GetResponse();
            XmlSerializer serial = new XmlSerializer(typeof(ArrayOfTinTucDTO));
            ArrayOfTinTucDTO ds = (ArrayOfTinTucDTO)serial.Deserialize(wp.GetResponseStream());
            gvTinTuc.DataSource = ds.Items;
            gvTinTuc.DataBind();
        }
        protected void gvTinTuc_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvTinTuc.PageIndex = e.NewPageIndex;
        }
    }
}